<!--
 * @Author: your name
 * @Date: 2022-04-11 09:16:30
 * @LastEditTime: 2022-04-11 09:28:57
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\geyao\找出在第一个数组出现,第二个数组不出现数字220411.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组问题</title>
</head>
<body>
  <script>
    var geyao = ["1","2","3","4"]
    var fangfang=["1","5"]

    function getArr(arr1,arr2){
      var str=arr2.join("")
      console.log(str,"str")
      var result=[]
      for(var i=0,x=0;i<arr1.length;i++){
        if(str.indexOf(arr1[i])==-1){
          result[x]=arr1[i]
          x++
        }
      }
      return result
    }
    console.log(getArr(geyao,fangfang))
  </script>
</body>
</html>